<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="邵铭">
    <title></title>
    <style>
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
        }

        header {
            width: 100%;
            height: 35px;
            border-bottom: 1px solid #EBEBEB;
        }


        header ul {
            width: 450px;
            margin: 0;
            padding: 0;
            list-style: none;
            float: right;
            display: flex;
            line-height: 35px;
            font-size: 16px;
        }

        header ul a {
            color: #333333;
        }

        .h-left a {
            font-weight: bold;
        }

        .h-right {
            margin-right: -110px;
        }

        header li {
            margin-right: 17px;
        }

        .container {
            width: 1000px;
            margin: 30px auto;
            /* border: 1px solid; */
        }

        .head img {
            width: 140px;
            height: 50px;
        }

        .search {
            display: inline-block;
        }

        .search .text {
            padding: 10px 0 0 0;
            width: 520px;
            height: 40px;
            font-size: 16px;
            margin: 0 0 10px 10px;
            background: #fff;
        }

        .search .btn {
            padding: 10px 0 0 0;
            width: 104px;
            height: 40px;
            margin: 0 0 10px -5px;
            border: 1px solid #3388FF;
            background-color: #3388FF;
            color: white;
            font-size: 16px;
            line-height: 40px;
            text-align: center;
        }

        section {
            float: right;
            margin: -40px 60px;
        }

        section a {
            color: #333333;
        }

        .xinwen {
            margin-left: 150px;
            color: #666666
        }

        nav {
            width: 100%;
            height: 40px;
            background-color: #01204F;
            color: white;
            position: fixed;
            top: 180px;
        }

        nav .list {
            width: 990px;
            font-size: 14px;
            line-height: 40px;
            list-style: none;
            display: flex;
            float: left;
            margin: 0;
        }

        nav li {
            height: 40px;
            font-size: 14px;
            line-height: 40px;
            font-weight: bold;
            margin-bottom: -10px;
            display: inline-block;
            padding: 5px 10px;
          
        }

        .content {
            width: 1100px;
            margin: 0 auto;
        }

        main {
            height: 2000px;
        }

        button {
            width: 60px;
            height: 60px;
            background-color: #6D91CF;
            position: fixed;
            right: 20%;
            color: white;
            font-size: 30px;
            bottom: 80px;
        }

        .active {
            color: white;
            background-color: red;
        }

        .clear {
            clear: both;
        }
    </style>
</head>

<body>
    <header>

        <ul class="h-right">
            <li><a href="">百度首页</a></li>
            <li><a href="">登录</a></li>
            <li><a href="">注册</a></li>
            <li><a href="">百度新闻客户端</a></li>

        </ul>
        <ul class="h-left">
            <li><a href="">网页</a></li>
            <li><a href="">新闻</a></li>
            <li><a href="">贴吧</a></li>
            <li><a href="">知道</a></li>
            <li><a href="">音乐</a></li>
            <li><a href="">图片</a></li>
            <li><a href="">视频</a></li>
            <li><a href="">地图</a></li>
            <li><a href="">文库</a></li>
            |
        </ul>
        <div class="clear"></div>
    </header>


    <div class="container">
        <div class="head">
            <img src="download.png" alt="">
            <div class="search">
                <input type="text" class="text">
                <input type="text" class="btn" value="百度一下">
            </div>
            <section><a href="">帮助</a>
                <a href="">高级搜索</a>
                <a href="">设置</a></section>
        </div>
        <div class="xinwen">
            <input type="radio" name="xinwen" checked>新闻全文
            <input type="radio" name="xinwen">新闻标题
        </div>
    </div>

    <nav>
        <div class="content">
            <ul class="list">
                <li class="active">首页</li>
                <li>百家号</li>
                <li>国内</li>
                <li>国际</li>
                <li>军事</li>
                <li>社会</li>
                <li>财经</li>
                <li>娱乐</li>
                <li>体育</li>
                <li>互联网</li>
                <li>科技</li>
                <li>游戏</li>
                <li>时尚</li>
                <li>女人</li>
                <li>汽车</li>
                <li>个性推荐</li>
                <li>更多</li>
            </ul>
            <div class="clear"></div>
        </div>
    </nav>
    <div class="content">
        <main>
            <button type="button" onclick="newClick(event)">&#8593;</button>
        </main>
    </div>




</body>

</html>
<script>
    var nav = document.querySelector('nav');
    window.onscroll = function () {
        var scrollTop = document.scrollingElement.scrollTop;
        // console.log(scrollTop);
        if (scrollTop > 180) {
            nav.style.position = 'fixed';
            nav.style.top = '0';
        } else {
            nav.style.cssText = '';

        }
    }
    var list = document.querySelector('.list');
    var lis = document.querySelectorAll('.list li');
    var lastIndex = 0;
    for (var i = 0; i < lis.length; i++) {
        lis[i].index = i;
        lis[i].onmouseover = function (ev) {
            lis[lastIndex].className = '';
            this.className = 'active';
            lis[0].className = 'active';

        }
        lis[i].onmouseout = function () {
            lastIndex = this.index;
        }
    }




    var button = document.querySelector('button');
    button.onclick = function () {
        button.style.backgroundColor = '#3064BB';
        document.scrollingElement.scrollTop = 0;
    }

</script>